/**********************************************************************
  The MIT License (MIT)
  Copyright (c) 2012 sunriseyuen

  Permission is hereby granted, free of charge, to any person obtaining
  a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be included
  in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
  THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 ***********************************************************************/

#define _DEF_CCY_CODE
#define _ZZDEBUG
#define _PROJ_DC

#region Using directives

using System;
using System.Text;
using System.IO;
using System.Xml;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Reflection;
using System.Web;
using System.Web.UI;

using Muki.Framework;
using Muki.Framework.UI;
using Muki.Framework.Business;
using Muki.Framework.Util;
using Muki.UserDefine;
using Muki.Entity;
using Dot.StreamObject;

#endregion

namespace Muki.UserPanel
{

	public class UID03102AV
	{
		public UID03102AV()
		{
		}

		public void setValue()
		{
					_UID03102AEntity.TRANS_CODE = _Convert.ToString(objTRANTBM_TRANS_CODE.Text);
					_UID03102AEntity.ITEM_NO = _Convert.ToString(objTRANTBM_ITEM_NO.Text);
					_UID03102AEntity.WH_CODE = _Convert.ToString(objTRANTBM_WH_CODE.Text);
					_UID03102AEntity.REFX_NO = _Convert.ToString(objTRANTBM_REFX_NO.Text);
					_UID03102AEntity.TRANS_DATE = _Convert.ToDateTime(objTRANTBM_TRANS_DATE.Text);

		}

		public void getValue()
		{

					objTRANTBM_TRANS_CODE.Text=_Convert.ToString(_UID03102AEntity.TRANS_CODE);
					objTRANTBM_ITEM_NO.Text=_Convert.ToString(_UID03102AEntity.ITEM_NO);
					objTRANTBM_WH_CODE.Text=_Convert.ToString(_UID03102AEntity.WH_CODE);
					objTRANTBM_REFX_NO.Text=_Convert.ToString(_UID03102AEntity.REFX_NO);
					objTRANTBM_TRANS_DATE.Text=_Convert.ToString(_UID03102AEntity.TRANS_DATE);

		}

		public void OnInit(HttpContext  objHttpContext)		
		{

			this.UID_CODE = "UID03102A";

			this.DbName = ZZGeneral.DbName();

				_STATUS_DATA.UID_CODE="UID03102A";
			_STATUS_DATA.OnInit(objHttpContext);

			_STATUS_DATA["lnk_UID_CODE"] = "UID03102A";
			_STATUS_DATA["UID03102A","USQL_CODE"] = "QID03102A";

			this.ZZEventOpts        = _STATUS_DATA["ZZEventOpts"];
			this.ZZLOGON_SSD        = _STATUS_DATA["ZZLOGON_SSD"];
			this.ZZLOGON_LANG       = _STATUS_DATA["ZZLOGON_LANG"];
			this.ZZEventStatus      = _STATUS_DATA["ZZEventStatus"];
			this.ZZEventMode        = _STATUS_DATA["ZZEventMode"];
			this.ZZEventArgs        = _STATUS_DATA["ZZEventArgs"];

			this.ZZVIEW_STATUS_CODE = _STATUS_DATA["UID03102A","ZZVIEW_STATUS_CODE"];
			this.ZZVIEW_MODE_CODE   = _STATUS_DATA["UID03102A","ZZVIEW_MODE_CODE"];

			this.Trans = new StreamContext(this.DbName);

			ZZTrace.Debug(ZFILE_NAME,"...123456...---"+this.ZZLOGON_SSD);

			XLiveManagement oXLiveManagement=XLiveManagement.getInstance();
			oXLiveManagement.DbName=this.DbName;
			this.ZZLOGON_ID=oXLiveManagement[this.ZZLOGON_SSD].getValue("LOGON_ID");

			if (this.ZZLOGON_LANG=="")
			{
				this.ZZLOGON_LANG=oXLiveManagement[this.ZZLOGON_SSD].getValue("LOGON_LANG");
			}

			ZZTrace.Debug(ZFILE_NAME,"...123456...---"+this.ZZLOGON_LANG);

			_STATUS_DATA["ZZLOGON_LANG"] = this.ZZLOGON_LANG;

			_Convert.ZZLOGON_SSD = this.ZZLOGON_SSD;
			_Convert.Trans       = this.Trans;

			_Captions             = new ZZCaptions();
			_Captions.DbName      = this.DbName;
			_Captions.ZZLOGON_LANG  = this.ZZLOGON_LANG;
			_Captions.ZZLOGON_SSD = this.ZZLOGON_SSD;

			_DocsPermission.Trans = this.Trans;

			oXForm                     = new XForm();
			oXForm.ZZLOGON_SSD         = this.ZZLOGON_SSD;
			oXForm.Trans               = this.Trans;
			oXForm.UID_CODE            = this.UID_CODE;
			oXForm.ZZLOGON_LANG          = this.ZZLOGON_LANG;
			ZZUSRDefine objZZUSRDefine = new ZZUSRDefine();
			objZZUSRDefine.ZZLOGON_SSD = this.ZZLOGON_SSD;

			WebTR     objWebTR=new WebTR();
			WebTD     objWebTD;
			WebCaption objWebCaption;

			XOption objXOption     = new XOption();
			objXOption.ZZLOGON_SSD = this.ZZLOGON_SSD;
			objXOption.UID_CODE    = this.UID_CODE;
			objXOption.Trans       = this.Trans;
			objXOption.ZZLOGON_LANG  = this.ZZLOGON_LANG;
			objXOption.All_Opt     = true;

			XOption oXOption     = new XOption();
			oXOption.ZZLOGON_SSD = this.ZZLOGON_SSD;
			oXOption.UID_CODE    = this.UID_CODE;
			oXOption.Trans       = this.Trans;
			oXOption.ZZLOGON_LANG  = this.ZZLOGON_LANG;

			if (ZZGeneral.XRequest("lnk_Viewer")!="")
			{
				lnk_Viewer=true;
			}

			QueryRows RsZUPRGDTM = new QueryRows(this.Trans);

			RsZUPRGDTM.CommandText = "SELECT * FROM ZUPRGDTM WHERE UID_CODE = '" + this.UID_CODE + "' AND ACTIVE_BIT<>0 ORDER BY ORDINAL";
			RsZUPRGDTM.Open();
			int ORDINAL=10000;
			while (!RsZUPRGDTM.EOF)
			{
				string cTABLE_NAME            = RsZUPRGDTM.getValue("TABLE_NAME");
				string cCOLUMN_NAME           = RsZUPRGDTM.getValue("COLUMN_NAME");
				string cSTAGEU_STATUS         = RsZUPRGDTM.getValue("STAGEU_STATUS");
				string cCOLUMN_NAME_B         = RsZUPRGDTM.getValue("BASE_COLUMN_NAME");
				string cTABLE_NAME_B          = RsZUPRGDTM.getValue("BASE_TABLE_NAME");
				string cCOLUMN_CLASS_CODE     = RsZUPRGDTM.getValue("COLUMN_CLASS_CODE");
				string cCOLUMN_TP_CODE        = RsZUPRGDTM.getValue("COLUMN_TP_CODE");
				string cDATA_VIEWER           = RsZUPRGDTM.getValue("DATA_VIEWER");
				string cUGET_XREF             = RsZUPRGDTM.getValue("RELY_DEFAULT");
				string cUGET_VIEW             = RsZUPRGDTM.getValue("RELY_VIEW");
				string cXOPT_CODE             = RsZUPRGDTM.getValue("OPT_CODE");
				bool bCOLUMN_NULLABLE         = !RsZUPRGDTM.getBoolean("COLUMN_NULLABLE");
				bool cLINE_REVEAL             = RsZUPRGDTM.getBoolean("LINE_REVEAL");
				bool cNewLine                 = RsZUPRGDTM.getBoolean("NEW_LINE");
				string cLABEL_ID              = RsZUPRGDTM.getValue("LABEL_ID");
				int    cCOLSPAN               = RsZUPRGDTM.getInteger("COLS_SPAN");
				int    cROWSPAN               = RsZUPRGDTM.getInteger("ROWS_SPAN");
				int    cCOLUMN_HEIGHT         = RsZUPRGDTM.getInteger("COLUMN_HEIGHT");
				int    cCOLUMN_SCALE          = 0;
				string TABLE_COLUMN_NAME = cTABLE_NAME + "_" + cCOLUMN_NAME;

				string _COLUMN=this.DbName+"_COLUMN_"+TABLE_COLUMN_NAME;
				if (oData.ContainsKey(_COLUMN))
				{
					VContexts _ZUCOLUTM=oData[_COLUMN];
					cCOLUMN_TP_CODE = _ZUCOLUTM.getValue("COLUMN_TP_CODE");
					cCOLUMN_SCALE  = _ZUCOLUTM.getInteger("COLUMN_SCALE");
				}else{
					QueryRows RsZUCOLUTM = new QueryRows(this.Trans);

					VContexts _ZUCOLUTM = new VContexts();
					RsZUCOLUTM.CommandText = "SELECT COLUMN_TP_CODE,COLUMN_SCALE FROM ZUCOLUTM WHERE TABLE_NAME = '" + cTABLE_NAME + "' AND COLUMN_NAME='" + cCOLUMN_NAME + "'";
					RsZUCOLUTM.Open();
					if (!RsZUCOLUTM.EOF)
					{
						_ZUCOLUTM["COLUMN_TP_CODE"]      = RsZUCOLUTM.getValue("COLUMN_TP_CODE");
						_ZUCOLUTM["COLUMN_SCALE"]       = RsZUCOLUTM.getInteger("COLUMN_SCALE");

					}else{
						_ZUCOLUTM["COLUMN_TP_CODE"]      = cCOLUMN_TP_CODE;
						_ZUCOLUTM["COLUMN_SCALE"]       = 0;
					}
					RsZUCOLUTM.Close();
					oData[_COLUMN]=_ZUCOLUTM;
					cCOLUMN_TP_CODE = _ZUCOLUTM.getValue("COLUMN_TP_CODE");
					cCOLUMN_SCALE  = _ZUCOLUTM.getInteger("COLUMN_SCALE");
				}

				if (cCOLUMN_TP_CODE == "decimal" && cCOLUMN_CLASS_CODE!="")
				{
					QueryRows RsZTCLASSM = new QueryRows(this.Trans);
					RsZTCLASSM.CommandText = "SELECT COLUMN_SCALE FROM ZTCLASSM WHERE COLUMN_CLASS_CODE = '" + cCOLUMN_CLASS_CODE + "'";
					RsZTCLASSM.Open();
					if (!RsZTCLASSM.EOF)
					{
						cCOLUMN_SCALE = RsZTCLASSM.getInteger("COLUMN_SCALE");
					}
					RsZTCLASSM.Close();
				}

				if (cCOLUMN_TP_CODE=="datetime")
				{

					WebDateBox oTABLE_COLUMN_NAME    = new WebDateBox();

					oTABLE_COLUMN_NAME.Name         = "Txt_" + TABLE_COLUMN_NAME+"_FM";
					oTABLE_COLUMN_NAME.Length       = 40;
					oTABLE_COLUMN_NAME.Height       = cCOLUMN_HEIGHT;
					oTABLE_COLUMN_NAME.COLUMN_SCALE = cCOLUMN_SCALE;
					oTABLE_COLUMN_NAME.STATUS_CODE  = cSTAGEU_STATUS;
					oTABLE_COLUMN_NAME.Compulsory   = bCOLUMN_NULLABLE;
					oTABLE_COLUMN_NAME.Caption      = _Captions.Caption(this.UID_CODE, cLABEL_ID);
					oTABLE_COLUMN_NAME.COLSPAN      = cCOLSPAN;
					oTABLE_COLUMN_NAME.ROWSPAN      = cROWSPAN;
					oTABLE_COLUMN_NAME.NEW_LINE     = cNewLine;
					oTABLE_COLUMN_NAME.NEW_CELL     = true;
					oTABLE_COLUMN_NAME.LINE_REVEAL  = cLINE_REVEAL;
					oTABLE_COLUMN_NAME.Index        = ORDINAL++;

					oXForm.AddObject(oTABLE_COLUMN_NAME);
					if (cTABLE_NAME!="VARIABLE")
					{
						oTABLE_COLUMN_NAME    = new WebDateBox();

						oTABLE_COLUMN_NAME.Name         = "Txt_" + TABLE_COLUMN_NAME+"_TO";
						oTABLE_COLUMN_NAME.Length       = 40;
						oTABLE_COLUMN_NAME.Height       = cCOLUMN_HEIGHT;
						oTABLE_COLUMN_NAME.COLUMN_SCALE = cCOLUMN_SCALE;
						oTABLE_COLUMN_NAME.STATUS_CODE  = cSTAGEU_STATUS;
						oTABLE_COLUMN_NAME.Compulsory   = bCOLUMN_NULLABLE;
						oTABLE_COLUMN_NAME.Caption      = _Captions.Caption(this.UID_CODE, cLABEL_ID);
						oTABLE_COLUMN_NAME.COLSPAN      = cCOLSPAN;
						oTABLE_COLUMN_NAME.ROWSPAN      = cROWSPAN;
						oTABLE_COLUMN_NAME.NEW_LINE     = false;
						oTABLE_COLUMN_NAME.NEW_CELL     = true;
						oTABLE_COLUMN_NAME.LINE_REVEAL  = cLINE_REVEAL;
						oTABLE_COLUMN_NAME.Index        = ORDINAL++;

						oXForm.AddObject(oTABLE_COLUMN_NAME);
					}					

				}else if (cCOLUMN_TP_CODE=="decimal")
				{

					WebDigitBox oTABLE_COLUMN_NAME    = new WebDigitBox();

					oTABLE_COLUMN_NAME.Name         = "Txt_" + TABLE_COLUMN_NAME;
					oTABLE_COLUMN_NAME.Length       = 8;
					oTABLE_COLUMN_NAME.Height       = cCOLUMN_HEIGHT;
					oTABLE_COLUMN_NAME.COLUMN_SCALE = cCOLUMN_SCALE;
					oTABLE_COLUMN_NAME.STATUS_CODE  = cSTAGEU_STATUS;
					oTABLE_COLUMN_NAME.Compulsory   = bCOLUMN_NULLABLE;
					oTABLE_COLUMN_NAME.Caption      = _Captions.Caption(this.UID_CODE, cLABEL_ID);
					oTABLE_COLUMN_NAME.COLSPAN      = cCOLSPAN;
					oTABLE_COLUMN_NAME.ROWSPAN      = cROWSPAN;
					oTABLE_COLUMN_NAME.NEW_LINE     = cNewLine;
					oTABLE_COLUMN_NAME.NEW_CELL     = true;
					oTABLE_COLUMN_NAME.LINE_REVEAL  = cLINE_REVEAL;
					oTABLE_COLUMN_NAME.Index        = ORDINAL++;

					oXForm.AddObject(oTABLE_COLUMN_NAME);

				}else if (cCOLUMN_TP_CODE=="boolean")
				{

					WebCheckBox oTABLE_COLUMN_NAME    = new WebCheckBox();

					oTABLE_COLUMN_NAME.Name        = "Txt_" + TABLE_COLUMN_NAME;
					oTABLE_COLUMN_NAME.Length      = 8;
					oTABLE_COLUMN_NAME.Height      = cCOLUMN_HEIGHT;
					oTABLE_COLUMN_NAME.STATUS_CODE = cSTAGEU_STATUS;
					oTABLE_COLUMN_NAME.Compulsory  = bCOLUMN_NULLABLE;
					oTABLE_COLUMN_NAME.Caption     = _Captions.Caption(this.UID_CODE, cLABEL_ID);
					oTABLE_COLUMN_NAME.COLSPAN     = cCOLSPAN;
					oTABLE_COLUMN_NAME.ROWSPAN     = cROWSPAN;
					oTABLE_COLUMN_NAME.NEW_LINE    = cNewLine;
					oTABLE_COLUMN_NAME.NEW_CELL    = true;
					oTABLE_COLUMN_NAME.LINE_REVEAL = cLINE_REVEAL;
					oTABLE_COLUMN_NAME.Index       = ORDINAL++;

					oXForm.AddObject(oTABLE_COLUMN_NAME);

				}else{
					if (cXOPT_CODE!="")
					{
						WebOption oTABLE_COLUMN_NAME    = new WebOption();

						oTABLE_COLUMN_NAME.Name         = "Txt_" + TABLE_COLUMN_NAME;
						oTABLE_COLUMN_NAME.Length       = 40;
						oTABLE_COLUMN_NAME.Height       = cCOLUMN_HEIGHT;
						oTABLE_COLUMN_NAME.COLUMN_SCALE = cCOLUMN_SCALE;
						oTABLE_COLUMN_NAME.STATUS_CODE  = cSTAGEU_STATUS;
						oTABLE_COLUMN_NAME.Compulsory   = bCOLUMN_NULLABLE;
						oTABLE_COLUMN_NAME.Caption      = _Captions.Caption(this.UID_CODE, cLABEL_ID);
						oTABLE_COLUMN_NAME.COLSPAN      = 4;
						oTABLE_COLUMN_NAME.ROWSPAN      = cROWSPAN;
						oTABLE_COLUMN_NAME.NEW_LINE     = cNewLine;
						oTABLE_COLUMN_NAME.NEW_CELL     = true;
						oTABLE_COLUMN_NAME.LINE_REVEAL  = cLINE_REVEAL;
						oTABLE_COLUMN_NAME.Index        = ORDINAL++;

						oXOption.COLUMN_NAME=cXOPT_CODE;
						oXOption.Process();
						oTABLE_COLUMN_NAME.Option       =oXOption.Option;

						oXForm.AddObject(oTABLE_COLUMN_NAME);

					}else{
						WebTextBox oTABLE_COLUMN_NAME   = new WebTextBox();

						oTABLE_COLUMN_NAME.Name         = "Txt_" + TABLE_COLUMN_NAME;
						oTABLE_COLUMN_NAME.Length       = 40;
						oTABLE_COLUMN_NAME.Height       = cCOLUMN_HEIGHT;
						oTABLE_COLUMN_NAME.COLUMN_SCALE = cCOLUMN_SCALE;
						oTABLE_COLUMN_NAME.STATUS_CODE  = cSTAGEU_STATUS;
						oTABLE_COLUMN_NAME.Compulsory   = bCOLUMN_NULLABLE;
						oTABLE_COLUMN_NAME.Caption      = _Captions.Caption(this.UID_CODE, cLABEL_ID);
						oTABLE_COLUMN_NAME.COLSPAN      = 4;
						oTABLE_COLUMN_NAME.ROWSPAN      = cROWSPAN;
						oTABLE_COLUMN_NAME.NEW_LINE     = cNewLine;
						oTABLE_COLUMN_NAME.NEW_CELL     = true;
						oTABLE_COLUMN_NAME.LINE_REVEAL  = cLINE_REVEAL;
						oTABLE_COLUMN_NAME.Index        = ORDINAL++;

						if (cUGET_XREF!="")
						{

							WebBrowser oTABLE_COLUMN_NAMEBrw =new WebBrowser();

							oTABLE_COLUMN_NAMEBrw.UGET_CODE    = cUGET_XREF;
							oTABLE_COLUMN_NAMEBrw.Data_Viewer  = cDATA_VIEWER;
							oTABLE_COLUMN_NAMEBrw.ACTIVE_FIELD = cTABLE_NAME_B+"."+cCOLUMN_NAME_B;

							oTABLE_COLUMN_NAME.Browser         =oTABLE_COLUMN_NAMEBrw;
						}

						if (cUGET_VIEW!="")
						{
							oTABLE_COLUMN_NAME.OnBlurEvents="RefreshData('"+cUGET_VIEW+"','VIEW','Txt_"+TABLE_COLUMN_NAME+"');";
						}else if (cUGET_XREF!="")
						{
							oTABLE_COLUMN_NAME.OnBlurEvents="RefreshData('"+cUGET_XREF+"','XREF','Txt_"+TABLE_COLUMN_NAME+"');";

							oTABLE_COLUMN_NAME.UGET_CODE=cUGET_XREF;
						}
						oXForm.AddObject(oTABLE_COLUMN_NAME);
					}
				}
				RsZUPRGDTM.MoveNext();  
			}

#region XUID_CODE
			objTRANTBM_XUID_CODE.Name    = "Txt_TRANTBM_XUID_CODE";
			objTRANTBM_XUID_CODE.Caption = _Captions.Caption(this.UID_CODE,"lbl_XUID_CODE");
			objTRANTBM_XUID_CODE.Text    = "UID03102A";
			oXForm.AuthObject(objTRANTBM_XUID_CODE);
#endregion

			_WebHideBox.Name = "lnk_DataUrl";
			oXForm.AddObject(_WebHideBox);

			objWebCells.Name          = "QID03102A";
			objWebCells.PickUp        = false;
			objWebCells.Trans         = this.Trans;
			objWebCells.ZZLOGON_SSD   = this.ZZLOGON_SSD;
			objWebCells.OperationMode = "ReadOnly";
			objWebCells.PageSize      = 20;
			objWebCells.DbName        = this.DbName;
			objWebCells.ZZLOGON_LANG  = this.ZZLOGON_LANG;

			oWindow.AddWxfPanel(objWebCells);

			oWindow.AddWebForm(oXForm);

			oWindow.ZZLOGON_SSD = this.ZZLOGON_SSD;
			oWindow.DbName = this.DbName;
			oWindow.OnInit(objHttpContext);
		}

		public void Render(HtmlTextWriter objTextWriter)
		{
			bool ZZFILE_VIEW=false;
			ZZTrace.Debug(ZFILE_NAME,ZZFileUrl);
			if (Entity.FileUrl!="")
			{
				ZZTrace.Debug(ZFILE_NAME,Entity.FileUrl);

				if (System.IO.File.Exists(Entity.FileUrl))
				{
					ZZFILE_VIEW=true;
				}
			}

			dbToolbar odbToolbar = new dbToolbar();
			odbToolbar.ZZLOGON_SSD = this.ZZLOGON_SSD;
			odbToolbar.ZZLOGON_LANG=this.ZZLOGON_LANG;

				odbToolbar.BTNS_CODE = "QUERY";
			odbToolbar.BTNS_CODE = "QUERY";
			odbToolbar.UID_CODE = this.UID_CODE;
			odbToolbar.Trans    =this.Trans;

			ZZTrace.Debug(ZFILE_NAME,"...123456...---"+this.ZZLOGON_LANG);

			string Template=this.APP_PATH+"Layouts\\Default\\UID03102A.lst";
			if (this.ZZLOGON_LANG!="")
			{
				if (System.IO.File.Exists(this.APP_PATH+"Layouts\\Default\\"+this.ZZLOGON_LANG+"\\UID03102A.lst"))
				{
					Template=this.APP_PATH+"Layouts\\Default\\"+this.ZZLOGON_LANG+"\\UID03102A.lst";
				}
			}

			ZZTrace.Debug(ZFILE_NAME,"...Template...---"+this.APP_PATH+"===="+Template);

			if (System.IO.File.Exists(Template) &&  !ZZGeneral.IsMobile())
			{
				odbToolbar.ODTP_STATUS_CODE="PRN";
			}else{
				odbToolbar.ODTP_STATUS_CODE="QRY";
			}

			ZZTrace.Debug(ZFILE_NAME,"...Template...---"+odbToolbar.ODTP_STATUS_CODE);

			odbToolbar.Process();

			objWebBTNS = odbToolbar.XWebBTNS;
			oWindow.AddToolBar(objWebBTNS);

			if (lnk_Viewer && ZZFILE_VIEW)
			{

				string lnk_DefaultPrintableDocument = ZZGeneral.XRequest("lnk_DefaultPrintableDocument");

				string PrintableDocument=_APP_PATH+"cfg\\PrintableDocument.xml";

				if (!File.Exists(PrintableDocument))
				{
					PrintableDocument=_APP_PATH+"cfg\\PrintableDocument.config";
				}

				ZZTrace.Debug(ZFILE_NAME,"...123456..PrintableDocument.---"+PrintableDocument);
				if (File.Exists(PrintableDocument))
				{
					if (string.IsNullOrEmpty(lnk_DefaultPrintableDocument))
					{
						lnk_DefaultPrintableDocument=ZZGeneral.Setting(PrintableDocument,"DefaultPrintableDocument","ll");
					}

					string DefaultPrintableExtensions= ZZGeneral.Setting(PrintableDocument,lnk_DefaultPrintableDocument,"ll");
					string cExtensions=_APP_PATH+"System\\Extensions\\"+DefaultPrintableExtensions+".dll";

					ZZTrace.Debug(ZFILE_NAME,"...123456..cExtensions.---"+cExtensions);

					if (File.Exists(cExtensions))
					{
						System.Reflection.Assembly objAssembly = Dot.StreamObject.Util.ReadAssembly(cExtensions);

						PrintableDocument oPrintableDocument = (PrintableDocument)objAssembly.CreateInstance(DefaultPrintableExtensions);

						oPrintableDocument.ZZLOGON_LANG = this.ZZLOGON_LANG;
						oPrintableDocument.UID_CODE   = "UID03102A";
						oPrintableDocument.DbName     = this.DbName;

						oPrintableDocument.APP_PATH   = _APP_PATH;
						oPrintableDocument.DataUrl    = Entity.DataUrl;
						oPrintableDocument.FileUrl    = Entity.FileUrl;

						oPrintableDocument.Render(objTextWriter);

					}
				}
			}else{

				objWebCells.ZZLOGON_SSD=this.ZZLOGON_SSD;
				oWindow.Trans      = this.Trans;
				oWindow.VIEW_STATUS_CODE = this.ZZVIEW_STATUS_CODE;
				oWindow.VIEW_MODE_CODE  = this.ZZVIEW_MODE_CODE;

				_STATUS_DATA["UID03102A","ZZVIEW_MODE_CODE"]   = this.ZZVIEW_MODE_CODE;
				_STATUS_DATA["UID03102A","ZZVIEW_STATUS_CODE"] = this.ZZVIEW_STATUS_CODE;

				objWebCells.STATUS_CODE ="VIEW";
				objWebCells.VIEW_STATUS_CODE   =this.ZZVIEW_STATUS_CODE;
				objWebCells.ZZLOGON_LANG=this.ZZLOGON_LANG;
				objWebCells.WXFLite     = Entity.Wxf;
				objWebCells.DataUrl     = Entity.DataUrl;
				objWebCells.ZZLOGON_LANG=this.ZZLOGON_LANG;
				objWebCells.OperationMode = "ReadOnly";
				objWebCells.Process();

				dbTab objdbTab       = new dbTab();
				objdbTab.UID_CODE    = this.UID_CODE;
				objdbTab.Trans       = this.Trans;
				objdbTab.ZZLOGON_LANG  = this.ZZLOGON_LANG;
				objdbTab.ZZLOGON_SSD = this.ZZLOGON_SSD;
				objdbTab.Create();

				objWebPanels=objdbTab.Panels;

				oWindow.AddPanels(objWebPanels);

				_WebHideBox.Text  = Entity.DataUrl;

				oWindow.WindowsStatus = _STATUS_DATA;
				oWindow.UID_CODE      = "UID03102A";
				oWindow.ZZLOGON_LANG    = this.ZZLOGON_LANG;
				oWindow.APP_PATH      = this.APP_PATH;
				oWindow.Template      = "";

				if (Entity.FileUrl!="")
				{
					oWindow.Java_Script = string.Format(@"llViewer('','UID03102A','{0}');",ZZGeneral.XUrlEncode(Entity.FileUrl));
				}	
				oWindow.Render(objTextWriter);
			}
		}

		private bool   lnk_Viewer               = false;
		private string ZZFileUrl                = "";

		private XForm             oXForm;             
		private WebPanels         objWebPanels    = new WebPanels();
		private ZZDocsPermission  _DocsPermission = new ZZDocsPermission();
		private	XStatus           _STATUS_DATA    = new XStatus();
		private	WebLookup         _WebLookup      = new WebLookup();
		private WebOption         _WebOption      = new WebOption();
		private Window            oWindow         = new Window();
		private WebBTNS           objWebBTNS      = new WebBTNS();

		private WebCaption  objTRANTBM_USTAGE_CODE     = new WebCaption();
		private WebCaption  objTRANTBM_XUID_CODE       = new WebCaption();

		private List<AComponent>  _ZZCDFElect     = new List<AComponent>();
		public List<LogisticException> Exceptions = new List<LogisticException>();

		private string         _ATVT_CODE          = "";
		private string         UID_CODE            = "UID03102A";
		private string         _DbName             = "";
		private string         _DATA_STATUS_CODE   = "NONE";
		private string         _LOGON_LANG         = "";
		private string         _ZZLOGON_SSD        = "";
		private string         _ZZEventOpts        = "";
		private string         _ZZVIEW_STATUS_CODE = "";
		private string         _ZZVIEW_MODE_CODE   = "";
		private string         _ZZEventStatus      = "";
		private string         _ZZEventMode        = "";
		private string         _ZZEventArgs        = "";
		private string         _ZZLOGON_ID         = "";
		private string         _APP_PATH           = "";
		private XConvert       _Convert            = new XConvert();
		private ZZCaptions     _Captions           = new ZZCaptions();
		private UID03102AE   _UID03102AEntity  = new UID03102AE();
		private WebCells objWebCells               = new WebCells();
		private WebHideBox _WebHideBox             = new WebHideBox();

		public UID03102AE Entity { get { return  _UID03102AEntity ; } set { _UID03102AEntity = value; }  }

		public string   ZZLookup          { get { return _WebLookup.Text;     } set { _WebLookup.Text     = value; }  }
		public string   ZZWebOption       { get { return _WebOption.Text;     } set { _WebOption.Text     = value; }  }
		public WebPanels ZZPanels         { get { return objWebPanels;        } set { objWebPanels        = value; }  }
		public string  DbName             { get { return _DbName;             } set { _DbName             = value; }  }
		public string  ZZLOGON_SSD        { get { return _ZZLOGON_SSD;        } set { _ZZLOGON_SSD        = value; }  }
		public string  ZZLOGON_ID         { get { return _ZZLOGON_ID;         } set { _ZZLOGON_ID         = value; }  }
		public string  ZZEventOpts        { get { return _ZZEventOpts;        } set { _ZZEventOpts        = value; }  }
		public string  ZZVIEW_STATUS_CODE { get { return _ZZVIEW_STATUS_CODE; } set { _ZZVIEW_STATUS_CODE = value; }  }
		public string  ZZVIEW_MODE_CODE   { get { return _ZZVIEW_MODE_CODE;   } set { _ZZVIEW_MODE_CODE   = value; }  }
		public string  ZZEventStatus      { get { return _ZZEventStatus;      } set { _ZZEventStatus      = value; }  }
		public string  ZZEventMode        { get { return _ZZEventMode;        } set { _ZZEventMode        = value; }  }
		public string  ZZEventArgs        { get { return _ZZEventArgs;        } set { _ZZEventArgs        = value; }  }
		public string  ZZLOGON_LANG       { get { return _LOGON_LANG;         } set { _LOGON_LANG         = value; }  }
		public string  ATVT_CODE          { get { return _ATVT_CODE;          } set { _ATVT_CODE          = value; }  }
		public string  APP_PATH           { get { return _APP_PATH;           } set { _APP_PATH           = value; }  }
		public string  DATA_STATUS_CODE   { get { return _DATA_STATUS_CODE;   } set { _DATA_STATUS_CODE   = value; }  }

		private StreamContext Trans;
		private static Dictionary<string, VContexts> oData = new Dictionary<string, VContexts>();
#region screen element

					private WebTextBox objTRANTBM_TRANS_CODE =new WebTextBox();
    private WebBrowser objTRANTBM_TRANS_CODEBrw =new WebBrowser();

					private WebTextBox objTRANTBM_ITEM_NO =new WebTextBox();
    private WebBrowser objTRANTBM_ITEM_NOBrw =new WebBrowser();

					private WebTextBox objTRANTBM_WH_CODE =new WebTextBox();
    private WebBrowser objTRANTBM_WH_CODEBrw =new WebBrowser();

					private WebTextBox objTRANTBM_REFX_NO =new WebTextBox();

					private WebDateBox objTRANTBM_TRANS_DATE =new WebDateBox();

#endregion
		const  string ZFILE_NAME   ="UID03102AV";
		const  string MUKI_EDITION ="MIN";

	}
}
